﻿using System;
using System.Collections.Generic;
using System.Linq;
using Helpers;
using TaleWorlds.CampaignSystem.Actions;
using TaleWorlds.CampaignSystem.CharacterDevelopment;
using TaleWorlds.CampaignSystem.Conversation;
using TaleWorlds.CampaignSystem.Extensions;
using TaleWorlds.CampaignSystem.Party;
using TaleWorlds.CampaignSystem.Roster;
using TaleWorlds.CampaignSystem.Settlements;
using TaleWorlds.Core;
using TaleWorlds.Library;
using TaleWorlds.Localization;
using TaleWorlds.ObjectSystem;
using TaleWorlds.SaveSystem;

namespace TaleWorlds.CampaignSystem.Issues
{
	// Token: 0x020002FE RID: 766
	public class ArtisanOverpricedGoodsIssueBehavior : CampaignBehaviorBase
	{
		// Token: 0x17000AF7 RID: 2807
		// (get) Token: 0x06002CD6 RID: 11478 RVA: 0x000BC080 File Offset: 0x000BA280
		private static IEnumerable<ItemObject> PossibleRequestedItems
		{
			get
			{
				yield return MBObjectManager.Instance.GetObject<ItemObject>("cow");
				yield return MBObjectManager.Instance.GetObject<ItemObject>("sheep");
				yield return MBObjectManager.Instance.GetObject<ItemObject>("wool");
				yield return MBObjectManager.Instance.GetObject<ItemObject>("iron");
				yield return MBObjectManager.Instance.GetObject<ItemObject>("leather");
				yield return MBObjectManager.Instance.GetObject<ItemObject>("hardwood");
				yield break;
			}
		}

		// Token: 0x06002CD7 RID: 11479 RVA: 0x000BC089 File Offset: 0x000BA289
		public override void RegisterEvents()
		{
			CampaignEvents.OnCheckForIssueEvent.AddNonSerializedListener(this, new Action<Hero>(this.OnCheckForIssue));
		}

		// Token: 0x06002CD8 RID: 11480 RVA: 0x000BC0A2 File Offset: 0x000BA2A2
		public override void SyncData(IDataStore dataStore)
		{
		}

		// Token: 0x06002CD9 RID: 11481 RVA: 0x000BC0A4 File Offset: 0x000BA2A4
		public void OnCheckForIssue(Hero hero)
		{
			Hero key;
			ItemObject value;
			if (this.ConditionsHold(hero, out key, out value))
			{
				KeyValuePair<Hero, ItemObject> keyValuePair = new KeyValuePair<Hero, ItemObject>(key, value);
				Campaign.Current.IssueManager.AddPotentialIssueData(hero, new PotentialIssueData(new PotentialIssueData.StartIssueDelegate(this.OnStartIssue), typeof(ArtisanOverpricedGoodsIssueBehavior.ArtisanOverpricedGoodsIssue), IssueBase.IssueFrequency.Common, keyValuePair));
				return;
			}
			Campaign.Current.IssueManager.AddPotentialIssueData(hero, new PotentialIssueData(typeof(ArtisanOverpricedGoodsIssueBehavior.ArtisanOverpricedGoodsIssue), IssueBase.IssueFrequency.Common));
		}

		// Token: 0x06002CDA RID: 11482 RVA: 0x000BC11C File Offset: 0x000BA31C
		private Hero GetAntagonistMerchant(Hero issueOwner)
		{
			return issueOwner.CurrentSettlement.Notables.GetRandomElementWithPredicate((Hero x) => x != issueOwner && x.IsMerchant && x.GetTraitLevel(DefaultTraits.Mercy) <= 0 && x.CanHaveQuestsOrIssues());
		}

		// Token: 0x06002CDB RID: 11483 RVA: 0x000BC158 File Offset: 0x000BA358
		private bool ConditionsHold(Hero IssueOwner, out Hero antagonistMerchant, out ItemObject requestedItem)
		{
			antagonistMerchant = null;
			requestedItem = null;
			if (IssueOwner.CurrentSettlement != null && IssueOwner.CurrentSettlement.IsTown && IssueOwner.IsArtisan)
			{
				antagonistMerchant = this.GetAntagonistMerchant(IssueOwner);
				if (antagonistMerchant != null)
				{
					foreach (ItemObject itemObject in ArtisanOverpricedGoodsIssueBehavior.PossibleRequestedItems)
					{
						if (IssueOwner.CurrentSettlement.Town.GetItemCategoryPriceIndex(itemObject.ItemCategory) > 1.4f)
						{
							requestedItem = itemObject;
							return true;
						}
					}
					return false;
				}
				return false;
			}
			return false;
		}

		// Token: 0x06002CDC RID: 11484 RVA: 0x000BC1F8 File Offset: 0x000BA3F8
		private IssueBase OnStartIssue(in PotentialIssueData pid, Hero issueOwner)
		{
			PotentialIssueData potentialIssueData = pid;
			KeyValuePair<Hero, ItemObject> keyValuePair = (KeyValuePair<Hero, ItemObject>)potentialIssueData.RelatedObject;
			return new ArtisanOverpricedGoodsIssueBehavior.ArtisanOverpricedGoodsIssue(issueOwner, keyValuePair.Key, keyValuePair.Value);
		}

		// Token: 0x04000D72 RID: 3442
		private const IssueBase.IssueFrequency ArtisanOverpricedGoodsIssueFrequency = IssueBase.IssueFrequency.Common;

		// Token: 0x04000D73 RID: 3443
		private const float HighestPriceIndexAtTown = 1.4f;

		// Token: 0x02000604 RID: 1540
		public class ArtisanOverpricedGoodsIssue : IssueBase
		{
			// Token: 0x060048B4 RID: 18612 RVA: 0x0015143A File Offset: 0x0014F63A
			internal static void AutoGeneratedStaticCollectObjectsArtisanOverpricedGoodsIssue(object o, List<object> collectedObjects)
			{
				((ArtisanOverpricedGoodsIssueBehavior.ArtisanOverpricedGoodsIssue)o).AutoGeneratedInstanceCollectObjects(collectedObjects);
			}

			// Token: 0x060048B5 RID: 18613 RVA: 0x00151448 File Offset: 0x0014F648
			protected override void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
			{
				base.AutoGeneratedInstanceCollectObjects(collectedObjects);
				collectedObjects.Add(this._requestedTradeGood);
				collectedObjects.Add(this.CounterOfferHero);
			}

			// Token: 0x060048B6 RID: 18614 RVA: 0x00151469 File Offset: 0x0014F669
			internal static object AutoGeneratedGetMemberValueRequestedTradeGoodAmount(object o)
			{
				return ((ArtisanOverpricedGoodsIssueBehavior.ArtisanOverpricedGoodsIssue)o).RequestedTradeGoodAmount;
			}

			// Token: 0x060048B7 RID: 18615 RVA: 0x0015147B File Offset: 0x0014F67B
			internal static object AutoGeneratedGetMemberValueCounterOfferHero(object o)
			{
				return ((ArtisanOverpricedGoodsIssueBehavior.ArtisanOverpricedGoodsIssue)o).CounterOfferHero;
			}

			// Token: 0x060048B8 RID: 18616 RVA: 0x00151488 File Offset: 0x0014F688
			internal static object AutoGeneratedGetMemberValue_goldReward(object o)
			{
				return ((ArtisanOverpricedGoodsIssueBehavior.ArtisanOverpricedGoodsIssue)o)._goldReward;
			}

			// Token: 0x060048B9 RID: 18617 RVA: 0x0015149A File Offset: 0x0014F69A
			internal static object AutoGeneratedGetMemberValue_requestedTradeGood(object o)
			{
				return ((ArtisanOverpricedGoodsIssueBehavior.ArtisanOverpricedGoodsIssue)o)._requestedTradeGood;
			}

			// Token: 0x17000E4C RID: 3660
			// (get) Token: 0x060048BA RID: 18618 RVA: 0x001514A7 File Offset: 0x0014F6A7
			public override int AlternativeSolutionBaseNeededMenCount
			{
				get
				{
					return 4 + MathF.Ceiling(6f * base.IssueDifficultyMultiplier);
				}
			}

			// Token: 0x17000E4D RID: 3661
			// (get) Token: 0x060048BB RID: 18619 RVA: 0x001514BC File Offset: 0x0014F6BC
			protected override int AlternativeSolutionBaseDurationInDaysInternal
			{
				get
				{
					return 3 + MathF.Ceiling(5f * base.IssueDifficultyMultiplier);
				}
			}

			// Token: 0x17000E4E RID: 3662
			// (get) Token: 0x060048BC RID: 18620 RVA: 0x001514D1 File Offset: 0x0014F6D1
			public override IssueBase.AlternativeSolutionScaleFlag AlternativeSolutionScaleFlags
			{
				get
				{
					return IssueBase.AlternativeSolutionScaleFlag.Duration;
				}
			}

			// Token: 0x17000E4F RID: 3663
			// (get) Token: 0x060048BD RID: 18621 RVA: 0x001514D4 File Offset: 0x0014F6D4
			protected override int RewardGold
			{
				get
				{
					return this._goldReward;
				}
			}

			// Token: 0x17000E50 RID: 3664
			// (get) Token: 0x060048BE RID: 18622 RVA: 0x001514DC File Offset: 0x0014F6DC
			// (set) Token: 0x060048BF RID: 18623 RVA: 0x001514E4 File Offset: 0x0014F6E4
			[SaveableProperty(12)]
			private int RequestedTradeGoodAmount { get; set; }

			// Token: 0x17000E51 RID: 3665
			// (get) Token: 0x060048C0 RID: 18624 RVA: 0x001514ED File Offset: 0x0014F6ED
			private int RequiredGoldForAlternativeSolution
			{
				get
				{
					return MathF.Floor((float)(this._requestedTradeGood.Value * this.RequestedTradeGoodAmount) * 0.75f);
				}
			}

			// Token: 0x17000E52 RID: 3666
			// (get) Token: 0x060048C1 RID: 18625 RVA: 0x0015150D File Offset: 0x0014F70D
			// (set) Token: 0x060048C2 RID: 18626 RVA: 0x00151515 File Offset: 0x0014F715
			[SaveableProperty(11)]
			public override Hero CounterOfferHero { get; protected set; }

			// Token: 0x17000E53 RID: 3667
			// (get) Token: 0x060048C3 RID: 18627 RVA: 0x0015151E File Offset: 0x0014F71E
			public override int NeededInfluenceForLordSolution
			{
				get
				{
					return 15 + MathF.Ceiling(35f * base.IssueDifficultyMultiplier);
				}
			}

			// Token: 0x17000E54 RID: 3668
			// (get) Token: 0x060048C4 RID: 18628 RVA: 0x00151534 File Offset: 0x0014F734
			public override TextObject IssueBriefByIssueGiver
			{
				get
				{
					return new TextObject("{=FKtkmwtb}I don't know if you know much about the law here... Craftsmen like me are required to buy our raw materials from local merchants. The other side of the bargain is that they offer us reasonable prices. But they're not doing that! They've come together and agreed on a price that's just too high. They don't care if it ruins us - they can always sell the goods elsewhere.[ib:hip][if:convo_thinking]", null);
				}
			}

			// Token: 0x17000E55 RID: 3669
			// (get) Token: 0x060048C5 RID: 18629 RVA: 0x00151541 File Offset: 0x0014F741
			public override TextObject IssueAcceptByPlayer
			{
				get
				{
					return new TextObject("{=j4V4fVBd}I see... How can I help?", null);
				}
			}

			// Token: 0x17000E56 RID: 3670
			// (get) Token: 0x060048C6 RID: 18630 RVA: 0x0015154E File Offset: 0x0014F74E
			protected override TextObject LordSolutionStartLog
			{
				get
				{
					return new TextObject("{=p5OHK0Lh}You decided to issue a decree banning the merchants' price-fixing arrangement.", null);
				}
			}

			// Token: 0x17000E57 RID: 3671
			// (get) Token: 0x060048C7 RID: 18631 RVA: 0x0015155B File Offset: 0x0014F75B
			protected override TextObject LordSolutionCounterOfferRefuseLog
			{
				get
				{
					return new TextObject("{=wrliXWLc}You approved the law which prevents price fixing in the markets and rejected the merchants' counter-offer.", null);
				}
			}

			// Token: 0x17000E58 RID: 3672
			// (get) Token: 0x060048C8 RID: 18632 RVA: 0x00151568 File Offset: 0x0014F768
			protected override TextObject LordSolutionCounterOfferAcceptLog
			{
				get
				{
					return new TextObject("{=bSguu34C}After listening to the town merchants, you decided to let the merchants continue price-fixing.", null);
				}
			}

			// Token: 0x17000E59 RID: 3673
			// (get) Token: 0x060048C9 RID: 18633 RVA: 0x00151578 File Offset: 0x0014F778
			public override TextObject IssueQuestSolutionExplanationByIssueGiver
			{
				get
				{
					TextObject textObject = new TextObject("{=epcc2knY}Well, you get around, right? It wouldn't be hard for you to collect the {.%}{SELECTED_GOOD}{.%} we need. If you could bring, say {SELECTED_AMOUNT} {.%}{?SELECTED_AMOUNT > 1}{PLURAL(SELECTED_GOOD)}{?}{SELECTED_GOOD}{\\?}{.%} directly to me instead of selling to the merchants, I would gladly pay {REWARD_AMOUNT}{GOLD_ICON} for them. With this, the merchants would have to lower their prices.[if:convo_calm_friendly][ib:confident3]", null);
					textObject.SetTextVariable("SELECTED_GOOD", this._requestedTradeGood.Name);
					textObject.SetTextVariable("SELECTED_AMOUNT", this.RequestedTradeGoodAmount);
					textObject.SetTextVariable("REWARD_AMOUNT", this.RewardGold);
					textObject.SetTextVariable("GOLD_ICON", "{=!}<img src=\"General\\Icons\\Coin@2x\" extend=\"8\">");
					return textObject;
				}
			}

			// Token: 0x17000E5A RID: 3674
			// (get) Token: 0x060048CA RID: 18634 RVA: 0x001515DC File Offset: 0x0014F7DC
			public override TextObject IssueAlternativeSolutionExplanationByIssueGiver
			{
				get
				{
					TextObject textObject = new TextObject("{=XvC1eLR1}Or, if you will not be able to acquire the goods yourself, you can perhaps assign one of your trusted companions to the task. Somewhat with a good understanding of trade and and around {TROOP_NUMBER} {?TROOP_NUMBER}troops{?}troop{\\?} could do it easily enough, along with {GOLD_COST}{GOLD_ICON} denars to make the purchases.[ib:normal2][if:convo_undecided_open]", null);
					textObject.SetTextVariable("TROOP_NUMBER", base.GetTotalAlternativeSolutionNeededMenCount());
					textObject.SetTextVariable("GOLD_COST", this.RequiredGoldForAlternativeSolution);
					textObject.SetTextVariable("GOLD_ICON", "{=!}<img src=\"General\\Icons\\Coin@2x\" extend=\"8\">");
					return textObject;
				}
			}

			// Token: 0x17000E5B RID: 3675
			// (get) Token: 0x060048CB RID: 18635 RVA: 0x0015162C File Offset: 0x0014F82C
			public override TextObject IssueLordSolutionExplanationByIssueGiver
			{
				get
				{
					TextObject textObject = new TextObject("{=JeL0aUOa}You could stop them with a decree, my {?PLAYER.GENDER}lady{?}lord{\\?}. All the craftsmen here would be very grateful.", null);
					StringHelpers.SetCharacterProperties("PLAYER", CharacterObject.PlayerCharacter, textObject, false);
					return textObject;
				}
			}

			// Token: 0x17000E5C RID: 3676
			// (get) Token: 0x060048CC RID: 18636 RVA: 0x00151658 File Offset: 0x0014F858
			public override TextObject IssueQuestSolutionAcceptByPlayer
			{
				get
				{
					TextObject textObject = new TextObject("{=mTuIMcLA}All right. I will bring {SELECTED_AMOUNT} {.%}{?SELECTED_AMOUNT > 1}{PLURAL(SELECTED_GOOD)}{?}{SELECTED_GOOD}{\\?}{.%} to you.", null);
					textObject.SetTextVariable("SELECTED_GOOD", this._requestedTradeGood.Name);
					textObject.SetTextVariable("SELECTED_AMOUNT", this.RequestedTradeGoodAmount);
					return textObject;
				}
			}

			// Token: 0x17000E5D RID: 3677
			// (get) Token: 0x060048CD RID: 18637 RVA: 0x0015168E File Offset: 0x0014F88E
			public override TextObject IssueAlternativeSolutionAcceptByPlayer
			{
				get
				{
					return new TextObject("{=79h7xNeL}I will have one of my companions take care of this.", null);
				}
			}

			// Token: 0x17000E5E RID: 3678
			// (get) Token: 0x060048CE RID: 18638 RVA: 0x0015169B File Offset: 0x0014F89B
			public override TextObject IssueDiscussAlternativeSolution
			{
				get
				{
					return new TextObject("{=E9GhODyh}I am very grateful to you for sparing your men to help us get what we need for a fair price.[if:convo_approving][ib:normal2]", null);
				}
			}

			// Token: 0x17000E5F RID: 3679
			// (get) Token: 0x060048CF RID: 18639 RVA: 0x001516A8 File Offset: 0x0014F8A8
			public override TextObject IssueAlternativeSolutionResponseByIssueGiver
			{
				get
				{
					TextObject textObject = new TextObject("{=2YiPE05P}Thank you, my {?PLAYER.GENDER}lady{?}lord{\\?}. Your companion will no doubt be very helpful.", null);
					StringHelpers.SetCharacterProperties("PLAYER", CharacterObject.PlayerCharacter, textObject, false);
					return textObject;
				}
			}

			// Token: 0x17000E60 RID: 3680
			// (get) Token: 0x060048D0 RID: 18640 RVA: 0x001516D4 File Offset: 0x0014F8D4
			public override TextObject IssueLordSolutionAcceptByPlayer
			{
				get
				{
					return new TextObject("{=xTKHO53L}This is outrageous. I declare that from now on that there shall be no price fixing.", null);
				}
			}

			// Token: 0x17000E61 RID: 3681
			// (get) Token: 0x060048D1 RID: 18641 RVA: 0x001516E4 File Offset: 0x0014F8E4
			public override TextObject IssueLordSolutionResponseByIssueGiver
			{
				get
				{
					TextObject textObject = new TextObject("{=6vPCEaSR}Thank you, my {?PLAYER.GENDER}lady{?}lord{\\?} that would be very good. Merchants will not like this but the hard-working artisans like me will be grateful to you for this.", null);
					StringHelpers.SetCharacterProperties("PLAYER", CharacterObject.PlayerCharacter, textObject, false);
					return textObject;
				}
			}

			// Token: 0x17000E62 RID: 3682
			// (get) Token: 0x060048D2 RID: 18642 RVA: 0x00151710 File Offset: 0x0014F910
			public override TextObject IssueLordSolutionCounterOfferBriefByOtherNpc
			{
				get
				{
					return new TextObject("{=ojNK5Zem}(One of the merchants in the town comes to talk as you are preparing to depart.)", null);
				}
			}

			// Token: 0x17000E63 RID: 3683
			// (get) Token: 0x060048D3 RID: 18643 RVA: 0x0015171D File Offset: 0x0014F91D
			public override TextObject IssueLordSolutionCounterOfferExplanationByOtherNpc
			{
				get
				{
					return new TextObject("{=8Tqv9ezH}We heard you wish to issue a decree changing our longstanding rules on pricing. Of course this is your right, but I'd like to remind you that we merchants pay significantly more taxes than the artisans. I would ask you to think of the finances of the town, and reconsider this.", null);
				}
			}

			// Token: 0x17000E64 RID: 3684
			// (get) Token: 0x060048D4 RID: 18644 RVA: 0x0015172A File Offset: 0x0014F92A
			public override TextObject IssueLordSolutionCounterOfferAcceptByPlayer
			{
				get
				{
					return new TextObject("{=FyTGbvLS}On second thought, I have decided not to interfere with the merchant's business.", null);
				}
			}

			// Token: 0x17000E65 RID: 3685
			// (get) Token: 0x060048D5 RID: 18645 RVA: 0x00151738 File Offset: 0x0014F938
			public override TextObject IssueLordSolutionCounterOfferAcceptResponseByOtherNpc
			{
				get
				{
					TextObject textObject = new TextObject("{=wynCFpsT}This is a wise decision, my {?PLAYER.GENDER}lady{?}lord{\\?}. Thank you.", null);
					StringHelpers.SetCharacterProperties("PLAYER", CharacterObject.PlayerCharacter, textObject, false);
					return textObject;
				}
			}

			// Token: 0x17000E66 RID: 3686
			// (get) Token: 0x060048D6 RID: 18646 RVA: 0x00151764 File Offset: 0x0014F964
			public override TextObject IssueLordSolutionCounterOfferDeclineByPlayer
			{
				get
				{
					return new TextObject("{=IXuaflOe}I stand by my decision.", null);
				}
			}

			// Token: 0x17000E67 RID: 3687
			// (get) Token: 0x060048D7 RID: 18647 RVA: 0x00151771 File Offset: 0x0014F971
			public override TextObject IssueLordSolutionCounterOfferDeclineResponseByOtherNpc
			{
				get
				{
					return new TextObject("{=ypAPaO1J}That's a pity.", null);
				}
			}

			// Token: 0x060048D8 RID: 18648 RVA: 0x0015177E File Offset: 0x0014F97E
			protected override void LordSolutionConsequenceWithRefuseCounterOffer()
			{
				this.ApplySuccessRewards(base.IssueOwner);
			}

			// Token: 0x060048D9 RID: 18649 RVA: 0x0015178C File Offset: 0x0014F98C
			protected override void LordSolutionConsequenceWithAcceptCounterOffer()
			{
				ChangeRelationAction.ApplyPlayerRelation(this.CounterOfferHero, 5, true, true);
				this.RelationshipChangeWithIssueOwner = -5;
				base.IssueSettlement.Town.Prosperity -= 30f;
				TraitLevelingHelper.OnIssueSolvedThroughBetrayal(base.IssueOwner, new Tuple<TraitObject, int>[]
				{
					new Tuple<TraitObject, int>(DefaultTraits.Honor, -50)
				});
				base.IssueOwner.AddPower(-5f);
			}

			// Token: 0x17000E68 RID: 3688
			// (get) Token: 0x060048DA RID: 18650 RVA: 0x001517FC File Offset: 0x0014F9FC
			protected override TextObject AlternativeSolutionStartLog
			{
				get
				{
					TextObject textObject = new TextObject("{=aeKdXKnO}{ISSUE_GIVER.LINK}, an artisan from {SETTLEMENT}, has told you that a local merchant {COUNTER_OFFER.LINK} is asking ridiculous amounts of money for raw materials which {?ISSUE_GIVER.GENDER}she{?}he{\\?} needs to continue {?ISSUE_GIVER.GENDER}her{?}his{\\?} work. {?ISSUE_GIVER.GENDER}She{?}He{\\?} is willing to pay {REWARD_AMOUNT}{GOLD_ICON} for help obtaining the needed goods.{newline}You asked {COMPANION.LINK} to stay with {?ISSUE_GIVER.GENDER}her{?}him{\\?} and try to solve {?ISSUE_GIVER.GENDER}her{?}his{\\?} problems. You expect {COMPANION.LINK} to report back to you in {RETURN_DAYS} days.", null);
					StringHelpers.SetCharacterProperties("ISSUE_GIVER", base.IssueOwner.CharacterObject, textObject, false);
					StringHelpers.SetCharacterProperties("COUNTER_OFFER", this.CounterOfferHero.CharacterObject, textObject, false);
					textObject.SetCharacterProperties("COMPANION", base.AlternativeSolutionHero.CharacterObject, false);
					textObject.SetTextVariable("SETTLEMENT", base.IssueOwner.CurrentSettlement.EncyclopediaLinkWithName);
					textObject.SetTextVariable("REWARD_AMOUNT", this.RewardGold);
					textObject.SetTextVariable("GOLD_ICON", "{=!}<img src=\"General\\Icons\\Coin@2x\" extend=\"8\">");
					textObject.SetTextVariable("RETURN_DAYS", base.GetTotalAlternativeSolutionDurationInDays());
					return textObject;
				}
			}

			// Token: 0x17000E69 RID: 3689
			// (get) Token: 0x060048DB RID: 18651 RVA: 0x001518AE File Offset: 0x0014FAAE
			public override bool IsThereAlternativeSolution
			{
				get
				{
					return true;
				}
			}

			// Token: 0x17000E6A RID: 3690
			// (get) Token: 0x060048DC RID: 18652 RVA: 0x001518B1 File Offset: 0x0014FAB1
			public override bool IsThereLordSolution
			{
				get
				{
					return true;
				}
			}

			// Token: 0x17000E6B RID: 3691
			// (get) Token: 0x060048DD RID: 18653 RVA: 0x001518B4 File Offset: 0x0014FAB4
			public override TextObject Title
			{
				get
				{
					TextObject textObject = new TextObject("{=dt6kKXSL}Overpriced Raw Materials at {SETTLEMENT}", null);
					textObject.SetTextVariable("SETTLEMENT", base.IssueSettlement.Name);
					return textObject;
				}
			}

			// Token: 0x17000E6C RID: 3692
			// (get) Token: 0x060048DE RID: 18654 RVA: 0x001518D8 File Offset: 0x0014FAD8
			public override TextObject Description
			{
				get
				{
					TextObject textObject = new TextObject("{=U90asNb9}Artisans in {SETTLEMENT} cannot continue their work because of the overpriced raw materials.", null);
					textObject.SetTextVariable("SETTLEMENT", base.IssueOwner.CurrentSettlement.Name);
					return textObject;
				}
			}

			// Token: 0x17000E6D RID: 3693
			// (get) Token: 0x060048DF RID: 18655 RVA: 0x00151904 File Offset: 0x0014FB04
			public override TextObject IssueAsRumorInSettlement
			{
				get
				{
					TextObject textObject = new TextObject("{=FPbmUpy7}{QUEST_GIVER.NAME} is in quite a stew over the merchants' monopoly, so I hear.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.IssueOwner.CharacterObject, textObject, false);
					return textObject;
				}
			}

			// Token: 0x17000E6E RID: 3694
			// (get) Token: 0x060048E0 RID: 18656 RVA: 0x00151936 File Offset: 0x0014FB36
			public override TextObject IssueAlternativeSolutionSuccessLog
			{
				get
				{
					TextObject textObject = new TextObject("{=3r2HLPQ1}Your {COMPANION.LINK} has delivered {ISSUE_GIVER.LINK}'s goods as you promised.", null);
					textObject.SetCharacterProperties("COMPANION", base.AlternativeSolutionHero.CharacterObject, false);
					textObject.SetCharacterProperties("ISSUE_GIVER", base.IssueOwner.CharacterObject, false);
					return textObject;
				}
			}

			// Token: 0x060048E1 RID: 18657 RVA: 0x00151971 File Offset: 0x0014FB71
			public ArtisanOverpricedGoodsIssue(Hero issueOwner, Hero counterOfferHero, ItemObject requestedTradeGood) : base(issueOwner, CampaignTime.DaysFromNow(30f))
			{
				this.CounterOfferHero = counterOfferHero;
				this._requestedTradeGood = requestedTradeGood;
				this.CalculateTradeGoodsAmountAndReward();
			}

			// Token: 0x060048E2 RID: 18658 RVA: 0x00151998 File Offset: 0x0014FB98
			protected override float GetIssueEffectAmountInternal(IssueEffect issueEffect)
			{
				if (issueEffect == DefaultIssueEffects.SettlementProsperity)
				{
					return -0.4f;
				}
				return 0f;
			}

			// Token: 0x060048E3 RID: 18659 RVA: 0x001519B0 File Offset: 0x0014FBB0
			public override bool IssueStayAliveConditions()
			{
				return base.IssueOwner.CurrentSettlement.Town.GetItemCategoryPriceIndex(this._requestedTradeGood.ItemCategory) > 1.1999999f && this.CounterOfferHero.IsActive && this.CounterOfferHero.CurrentSettlement == base.IssueSettlement;
			}

			// Token: 0x060048E4 RID: 18660 RVA: 0x00151A06 File Offset: 0x0014FC06
			protected override void CompleteIssueWithTimedOutConsequences()
			{
			}

			// Token: 0x060048E5 RID: 18661 RVA: 0x00151A08 File Offset: 0x0014FC08
			public override ValueTuple<SkillObject, int> GetAlternativeSolutionSkill(Hero hero)
			{
				return new ValueTuple<SkillObject, int>((hero.GetSkillValue(DefaultSkills.Roguery) >= hero.GetSkillValue(DefaultSkills.Trade)) ? DefaultSkills.Roguery : DefaultSkills.Trade, 120);
			}

			// Token: 0x060048E6 RID: 18662 RVA: 0x00151A35 File Offset: 0x0014FC35
			public override bool AlternativeSolutionCondition(out TextObject explanation)
			{
				explanation = TextObject.Empty;
				return QuestHelper.CheckRosterForAlternativeSolution(MobileParty.MainParty.MemberRoster, base.GetTotalAlternativeSolutionNeededMenCount(), ref explanation, 2, false) && QuestHelper.CheckGoldForAlternativeSolution(this.RequiredGoldForAlternativeSolution, ref explanation);
			}

			// Token: 0x060048E7 RID: 18663 RVA: 0x00151A66 File Offset: 0x0014FC66
			public override bool DoTroopsSatisfyAlternativeSolution(TroopRoster troopRoster, out TextObject explanation)
			{
				explanation = TextObject.Empty;
				return QuestHelper.CheckRosterForAlternativeSolution(troopRoster, base.GetTotalAlternativeSolutionNeededMenCount(), ref explanation, 2, false);
			}

			// Token: 0x060048E8 RID: 18664 RVA: 0x00151A7E File Offset: 0x0014FC7E
			public override void AlternativeSolutionStartConsequence()
			{
				GiveGoldAction.ApplyBetweenCharacters(Hero.MainHero, null, this.RequiredGoldForAlternativeSolution, false);
			}

			// Token: 0x060048E9 RID: 18665 RVA: 0x00151A92 File Offset: 0x0014FC92
			protected override void AlternativeSolutionEndWithSuccessConsequence()
			{
				this.ApplySuccessRewards(base.IssueOwner);
			}

			// Token: 0x060048EA RID: 18666 RVA: 0x00151AA0 File Offset: 0x0014FCA0
			public override bool LordSolutionCondition(out TextObject explanation)
			{
				if (Clan.PlayerClan == Settlement.CurrentSettlement.OwnerClan)
				{
					explanation = TextObject.Empty;
					return true;
				}
				explanation = new TextObject("{=bItEf0WN}You need to be the {?PLAYER.GENDER}lady{?}lord{\\?} of this settlement.", null);
				StringHelpers.SetCharacterProperties("PLAYER", Hero.MainHero.CharacterObject, explanation, false);
				return false;
			}

			// Token: 0x17000E6F RID: 3695
			// (get) Token: 0x060048EB RID: 18667 RVA: 0x00151AED File Offset: 0x0014FCED
			protected override int CompanionSkillRewardXP
			{
				get
				{
					return (int)(400f + 1700f * base.IssueDifficultyMultiplier);
				}
			}

			// Token: 0x060048EC RID: 18668 RVA: 0x00151B04 File Offset: 0x0014FD04
			private void ApplySuccessRewards(Hero issueGiver)
			{
				issueGiver.AddPower(10f);
				ChangeRelationAction.ApplyPlayerRelation(issueGiver, 5, true, true);
				ChangeRelationAction.ApplyPlayerRelation(this.CounterOfferHero, -10, true, true);
				this.CounterOfferHero.AddPower(-10f);
				issueGiver.CurrentSettlement.Town.Prosperity += 30f;
			}

			// Token: 0x060048ED RID: 18669 RVA: 0x00151B60 File Offset: 0x0014FD60
			public override IssueBase.IssueFrequency GetFrequency()
			{
				return IssueBase.IssueFrequency.Common;
			}

			// Token: 0x060048EE RID: 18670 RVA: 0x00151B63 File Offset: 0x0014FD63
			protected override bool CanPlayerTakeQuestConditions(Hero issueGiver, out IssueBase.PreconditionFlags flag, out Hero relationHero, out SkillObject skill)
			{
				flag = IssueBase.PreconditionFlags.None;
				relationHero = null;
				skill = null;
				if (issueGiver.GetRelationWithPlayer() < -10f)
				{
					flag |= IssueBase.PreconditionFlags.Relation;
					relationHero = issueGiver;
				}
				return flag == IssueBase.PreconditionFlags.None;
			}

			// Token: 0x060048EF RID: 18671 RVA: 0x00151B8C File Offset: 0x0014FD8C
			private void CalculateTradeGoodsAmountAndReward()
			{
				this.RequestedTradeGoodAmount = MathF.Max((int)(2500f / (float)this._requestedTradeGood.Value * base.IssueDifficultyMultiplier), 1);
				this._goldReward = 300 + (int)((float)(base.IssueOwner.CurrentSettlement.Town.GetItemPrice(this._requestedTradeGood, null, false) + this._requestedTradeGood.Value) / 2f) * this.RequestedTradeGoodAmount;
			}

			// Token: 0x060048F0 RID: 18672 RVA: 0x00151C03 File Offset: 0x0014FE03
			protected override void OnGameLoad()
			{
				if (this.RequestedTradeGoodAmount == 0 || this._goldReward == 0)
				{
					this.CalculateTradeGoodsAmountAndReward();
				}
			}

			// Token: 0x060048F1 RID: 18673 RVA: 0x00151C1B File Offset: 0x0014FE1B
			protected override void HourlyTick()
			{
			}

			// Token: 0x060048F2 RID: 18674 RVA: 0x00151C1D File Offset: 0x0014FE1D
			protected override QuestBase GenerateIssueQuest(string questId)
			{
				return new ArtisanOverpricedGoodsIssueBehavior.ArtisanOverpricedGoodsIssueQuest(questId, base.IssueOwner, CampaignTime.DaysFromNow(30f), this._requestedTradeGood, this.RewardGold, this.RequestedTradeGoodAmount, this.CounterOfferHero);
			}

			// Token: 0x040018DD RID: 6365
			private const int RequiredTradeSkillLevelForSendingComp = 120;

			// Token: 0x040018DE RID: 6366
			private const int BaseRewardGold = 300;

			// Token: 0x040018DF RID: 6367
			private const int IssueDuration = 30;

			// Token: 0x040018E0 RID: 6368
			private const int QuestTimeLimit = 30;

			// Token: 0x040018E1 RID: 6369
			private const int MinimumAlternativeTroopTier = 2;

			// Token: 0x040018E2 RID: 6370
			[SaveableField(13)]
			private int _goldReward;

			// Token: 0x040018E4 RID: 6372
			[SaveableField(10)]
			private ItemObject _requestedTradeGood;
		}

		// Token: 0x02000605 RID: 1541
		public class ArtisanOverpricedGoodsIssueQuest : QuestBase
		{
			// Token: 0x060048F3 RID: 18675 RVA: 0x00151C4D File Offset: 0x0014FE4D
			internal static void AutoGeneratedStaticCollectObjectsArtisanOverpricedGoodsIssueQuest(object o, List<object> collectedObjects)
			{
				((ArtisanOverpricedGoodsIssueBehavior.ArtisanOverpricedGoodsIssueQuest)o).AutoGeneratedInstanceCollectObjects(collectedObjects);
			}

			// Token: 0x060048F4 RID: 18676 RVA: 0x00151C5B File Offset: 0x0014FE5B
			protected override void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
			{
				base.AutoGeneratedInstanceCollectObjects(collectedObjects);
				collectedObjects.Add(this._requestedTradeGood);
				collectedObjects.Add(this._playerStartsQuestLog);
			}

			// Token: 0x060048F5 RID: 18677 RVA: 0x00151C7C File Offset: 0x0014FE7C
			internal static object AutoGeneratedGetMemberValue_rewardGold(object o)
			{
				return ((ArtisanOverpricedGoodsIssueBehavior.ArtisanOverpricedGoodsIssueQuest)o)._rewardGold;
			}

			// Token: 0x060048F6 RID: 18678 RVA: 0x00151C8E File Offset: 0x0014FE8E
			internal static object AutoGeneratedGetMemberValue_requestedTradeGood(object o)
			{
				return ((ArtisanOverpricedGoodsIssueBehavior.ArtisanOverpricedGoodsIssueQuest)o)._requestedTradeGood;
			}

			// Token: 0x060048F7 RID: 18679 RVA: 0x00151C9B File Offset: 0x0014FE9B
			internal static object AutoGeneratedGetMemberValue_requestedTradeGoodAmount(object o)
			{
				return ((ArtisanOverpricedGoodsIssueBehavior.ArtisanOverpricedGoodsIssueQuest)o)._requestedTradeGoodAmount;
			}

			// Token: 0x060048F8 RID: 18680 RVA: 0x00151CAD File Offset: 0x0014FEAD
			internal static object AutoGeneratedGetMemberValue_givenTradeGoods(object o)
			{
				return ((ArtisanOverpricedGoodsIssueBehavior.ArtisanOverpricedGoodsIssueQuest)o)._givenTradeGoods;
			}

			// Token: 0x060048F9 RID: 18681 RVA: 0x00151CBF File Offset: 0x0014FEBF
			internal static object AutoGeneratedGetMemberValue_playerStartsQuestLog(object o)
			{
				return ((ArtisanOverpricedGoodsIssueBehavior.ArtisanOverpricedGoodsIssueQuest)o)._playerStartsQuestLog;
			}

			// Token: 0x17000E70 RID: 3696
			// (get) Token: 0x060048FA RID: 18682 RVA: 0x00151CCC File Offset: 0x0014FECC
			public override TextObject Title
			{
				get
				{
					TextObject textObject = new TextObject("{=dt6kKXSL}Overpriced Raw Materials at {SETTLEMENT}", null);
					textObject.SetTextVariable("SETTLEMENT", base.QuestGiver.CurrentSettlement.Name);
					return textObject;
				}
			}

			// Token: 0x17000E71 RID: 3697
			// (get) Token: 0x060048FB RID: 18683 RVA: 0x00151CF5 File Offset: 0x0014FEF5
			private Hero AntagonistHero
			{
				get
				{
					return base.QuestGiver.CurrentSettlement.Notables.FirstOrDefault((Hero x) => x != base.QuestGiver && x.IsMerchant && x.GetTraitLevel(DefaultTraits.Mercy) <= 0);
				}
			}

			// Token: 0x17000E72 RID: 3698
			// (get) Token: 0x060048FC RID: 18684 RVA: 0x00151D18 File Offset: 0x0014FF18
			public override bool IsRemainingTimeHidden
			{
				get
				{
					return false;
				}
			}

			// Token: 0x17000E73 RID: 3699
			// (get) Token: 0x060048FD RID: 18685 RVA: 0x00151D1C File Offset: 0x0014FF1C
			private TextObject _playerStartsQuestLogText
			{
				get
				{
					TextObject textObject = new TextObject("{=IL3QWZ93}{QUEST_GIVER.LINK}, an artisan from {SETTLEMENT}, has told you about local merchant asking ridiculous amounts of money for the raw materials that {?QUEST_GIVER.GENDER}she{?}he{\\?} needs to continue {?QUEST_GIVER.GENDER}her{?}his{\\?} work. You said that you can bring {?QUEST_GIVER.GENDER}her{?}him{\\?} {REQUESTED_AMOUNT} {.%}{?REQUESTED_AMOUNT > 1}{PLURAL(REQUESTED_GOOD)}{?}{REQUESTED_GOOD}{\\?}{.%}. {?QUEST_GIVER.GENDER}She{?}He{\\?} is willing to pay {REWARD_AMOUNT}{GOLD_ICON} for these items.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					textObject.SetTextVariable("SETTLEMENT", base.QuestGiver.CurrentSettlement.EncyclopediaLinkWithName);
					textObject.SetTextVariable("REQUESTED_AMOUNT", this._requestedTradeGoodAmount);
					textObject.SetTextVariable("REQUESTED_GOOD", this._requestedTradeGood.Name);
					textObject.SetTextVariable("REWARD_AMOUNT", this._rewardGold);
					textObject.SetTextVariable("GOLD_ICON", "{=!}<img src=\"General\\Icons\\Coin@2x\" extend=\"8\">");
					return textObject;
				}
			}

			// Token: 0x17000E74 RID: 3700
			// (get) Token: 0x060048FE RID: 18686 RVA: 0x00151DB8 File Offset: 0x0014FFB8
			private TextObject _successQuestLogText
			{
				get
				{
					TextObject textObject = new TextObject("{=6XvszYj2}You brought {REQUESTED_AMOUNT} {.%}{?REQUESTED_AMOUNT > 1}{PLURAL(REQUESTED_GOOD)}{?}{REQUESTED_GOOD}{\\?}{.%} to {?QUEST_GIVER.GENDER}her{?}him{\\?} as promised.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					textObject.SetTextVariable("REQUESTED_AMOUNT", this._requestedTradeGoodAmount);
					textObject.SetTextVariable("REQUESTED_GOOD", this._requestedTradeGood.Name);
					return textObject;
				}
			}

			// Token: 0x17000E75 RID: 3701
			// (get) Token: 0x060048FF RID: 18687 RVA: 0x00151E14 File Offset: 0x00150014
			private TextObject _timeoutQuestLogText
			{
				get
				{
					TextObject textObject = new TextObject("{=Ts5dZih4}You couldn't fully bring {.%}{REQUESTED_GOOD}{.%} to {?QUEST_GIVER.GENDER}her{?}him{\\?} in time.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					textObject.SetTextVariable("REQUESTED_GOOD", this._requestedTradeGood.Name);
					return textObject;
				}
			}

			// Token: 0x06004900 RID: 18688 RVA: 0x00151E5D File Offset: 0x0015005D
			protected override void InitializeQuestOnGameLoad()
			{
				this.SetDialogs();
				Campaign.Current.ConversationManager.AddDialogFlow(this.GetMerchantDialogFlow(), this);
			}

			// Token: 0x06004901 RID: 18689 RVA: 0x00151E7B File Offset: 0x0015007B
			protected override void HourlyTick()
			{
			}

			// Token: 0x06004902 RID: 18690 RVA: 0x00151E7D File Offset: 0x0015007D
			public ArtisanOverpricedGoodsIssueQuest(string questId, Hero questGiver, CampaignTime dueTime, ItemObject requestedTradeGood, int rewardGold, int requestedTradeGoodAmount, Hero counterOfferHero) : base(questId, questGiver, dueTime, rewardGold)
			{
				this._requestedTradeGood = requestedTradeGood;
				this._requestedTradeGoodAmount = requestedTradeGoodAmount;
				this._rewardGold = rewardGold;
				this.SetDialogs();
				base.InitializeQuestOnCreation();
			}

			// Token: 0x06004903 RID: 18691 RVA: 0x00151EB0 File Offset: 0x001500B0
			protected override void SetDialogs()
			{
				this.OfferDialogFlow = DialogFlow.CreateDialogFlow("issue_classic_quest_start", 100).NpcLine(new TextObject("{=e1sSXEOh}This is excellent news. If you could bring the goods, it would be an immense help, and the merchants would have to lower their prices. Thank you.[if:convo_excited][ib:hip2]", null), null, null).Condition(() => Hero.OneToOneConversationHero == base.QuestGiver).Consequence(new ConversationSentence.OnConsequenceDelegate(this.QuestAcceptedConsequences)).CloseDialog();
				TextObject textObject = new TextObject("{=fKnkkWH1}Have you brought any {.%}{REQUESTED_GOOD}{.%}? My stocks are running out and I need some very soon.", null);
				textObject.SetTextVariable("REQUESTED_GOOD", this._requestedTradeGood.Name);
				TextObject textObject2 = new TextObject("{=bPbzwMat}I could only deliver {AMOUNT_TO_DELIVER} {.%}{?AMOUNT_TO_DELIVER > 1}{PLURAL(REQUESTED_GOOD)}{?}{REQUESTED_GOOD}{\\?}{.%}.", null);
				textObject2.SetTextVariable("REQUESTED_GOOD", this._requestedTradeGood.Name);
				textObject2.SetTextVariable("AMOUNT_TO_DELIVER", this.GetAvailableRequestedItemCountOnPlayer());
				TextObject npcText = new TextObject("{=IfF3OHNT}Thank you. These will be very useful. If you can get your hands on more, please bring them directly to me.", null);
				TextObject textObject3 = new TextObject("{=1LzohiMf}I brought {AMOUNT_TO_DELIVER} {.%}{?AMOUNT_TO_DELIVER > 1}{PLURAL(REQUESTED_GOOD)}{?}{REQUESTED_GOOD}{\\?}{.%} as we agreed.", null);
				textObject3.SetTextVariable("AMOUNT_TO_DELIVER", this._requestedTradeGoodAmount - this._givenTradeGoods);
				textObject3.SetTextVariable("REQUESTED_GOOD", this._requestedTradeGood.Name);
				TextObject npcText2 = new TextObject("{=cxQGUbUD}I'm so grateful! You've kept my workshop running and my family fed. Please take this money and some extra to cover your costs.[if:convo_grateful][ib:normal2]", null);
				TextObject text = new TextObject("{=4uKTfTg9}Sorry. I don't have anything for you this time.", null);
				TextObject npcText3 = new TextObject("{=YWorGaI1}Ah... We'll get by. I won't lie. It will be hard. I just hope you can deliver some soon.[if:convo_normal][ib:closed]", null);
				this.DiscussDialogFlow = DialogFlow.CreateDialogFlow("quest_discuss", 100).NpcLine(textObject, null, null).Condition(() => Hero.OneToOneConversationHero == base.QuestGiver).BeginPlayerOptions().PlayerOption(textObject2, null).Condition(delegate
				{
					int availableRequestedItemCountOnPlayer = this.GetAvailableRequestedItemCountOnPlayer();
					Campaign.Current.ConversationManager.GetCurrentDialogLine().SetTextVariable("REQUESTED_GOOD", this._requestedTradeGood.Name);
					Campaign.Current.ConversationManager.GetCurrentDialogLine().SetTextVariable("AMOUNT_TO_DELIVER", availableRequestedItemCountOnPlayer);
					return availableRequestedItemCountOnPlayer > 0 && availableRequestedItemCountOnPlayer < this._requestedTradeGoodAmount - this._givenTradeGoods;
				}).Consequence(new ConversationSentence.OnConsequenceDelegate(this.DeliverItemsPartiallyOnConsequence)).NpcLine(npcText, null, null).CloseDialog().PlayerOption(textObject3, null).Condition(delegate
				{
					int availableRequestedItemCountOnPlayer = this.GetAvailableRequestedItemCountOnPlayer();
					Campaign.Current.ConversationManager.GetCurrentDialogLine().SetTextVariable("AMOUNT_TO_DELIVER", this._requestedTradeGoodAmount - this._givenTradeGoods);
					Campaign.Current.ConversationManager.GetCurrentDialogLine().SetTextVariable("REQUESTED_GOOD", this._requestedTradeGood.Name);
					return availableRequestedItemCountOnPlayer >= this._requestedTradeGoodAmount - this._givenTradeGoods;
				}).Consequence(new ConversationSentence.OnConsequenceDelegate(this.DeliverItemsFullyOnConsequence)).NpcLine(npcText2, null, null).Consequence(new ConversationSentence.OnConsequenceDelegate(base.CompleteQuestWithSuccess)).CloseDialog().PlayerOption(text, null).NpcLine(npcText3, null, null).CloseDialog().EndPlayerOptions().CloseDialog();
			}

			// Token: 0x06004904 RID: 18692 RVA: 0x0015209D File Offset: 0x0015029D
			private int GetAvailableRequestedItemCountOnPlayer()
			{
				return PartyBase.MainParty.ItemRoster.GetItemNumber(this._requestedTradeGood);
			}

			// Token: 0x06004905 RID: 18693 RVA: 0x001520B4 File Offset: 0x001502B4
			private void DeliverItemsPartiallyOnConsequence()
			{
				int num = this.GetAvailableRequestedItemCountOnPlayer();
				if (PartyBase.MainParty.ItemRoster.ElementAt(PartyBase.MainParty.ItemRoster.FindIndex((ItemObject x) => x == this._requestedTradeGood)).Amount <= 0)
				{
					num = 0;
				}
				PartyBase.MainParty.ItemRoster.AddToCounts(this._requestedTradeGood, -num);
				this._givenTradeGoods += num;
				base.UpdateQuestTaskStage(this._playerStartsQuestLog, this._givenTradeGoods);
			}

			// Token: 0x06004906 RID: 18694 RVA: 0x00152138 File Offset: 0x00150338
			private void DeliverItemsFullyOnConsequence()
			{
				TraitLevelingHelper.OnIssueSolvedThroughQuest(base.QuestGiver, new Tuple<TraitObject, int>[]
				{
					new Tuple<TraitObject, int>(DefaultTraits.Honor, 50)
				});
				ChangeCrimeRatingAction.Apply(base.QuestGiver.MapFaction, 5f, true);
				PartyBase.MainParty.ItemRoster.AddToCounts(this._requestedTradeGood, -(this._requestedTradeGoodAmount - this._givenTradeGoods));
				this._givenTradeGoods = this._requestedTradeGoodAmount;
				base.UpdateQuestTaskStage(this._playerStartsQuestLog, this._givenTradeGoods);
			}

			// Token: 0x06004907 RID: 18695 RVA: 0x001521C0 File Offset: 0x001503C0
			private void QuestAcceptedConsequences()
			{
				base.StartQuest();
				this._playerStartsQuestLog = base.AddDiscreteLog(this._playerStartsQuestLogText, new TextObject("{=yw62BLhy}Delivered Goods", null), this._givenTradeGoods, this._requestedTradeGoodAmount, null, true);
				Campaign.Current.ConversationManager.AddDialogFlow(this.GetMerchantDialogFlow(), this);
			}

			// Token: 0x06004908 RID: 18696 RVA: 0x00152214 File Offset: 0x00150414
			private DialogFlow GetMerchantDialogFlow()
			{
				TextObject playerText = new TextObject("{=YNxGcaJI}I want to talk to you about the outlandish prices you're asking for the goods you sell the artisans.", null);
				TextObject npcText = new TextObject("{=UwEbBanm}These are the laws of our town. The artisans don't complain when the laws require us to buy tools from them.[if:convo_bored][ib:closed2]", null);
				TextObject npcText2 = new TextObject("{=sPEZq0Yk}What's sauce for the goose is sauce for the gander. We've done business for years like this and we're not just going to change things because one party complains.[if:convo_mocking_teasing][ib:hip]", null);
				TextObject text = new TextObject("{=VzzQX4EZ}Maybe you're right. I won't get involved in this.", null);
				TextObject text2 = new TextObject("{=KbFJJfl6}I am sorry. I will do what I must.", null);
				TextObject npcText3 = new TextObject("{=yccVH4KD}Thank you for listening to the voice of reason.", null);
				TextObject npcText4 = new TextObject("{=A8dyXgLz}That's a pity.", null);
				return DialogFlow.CreateDialogFlow("hero_main_options", 125).PlayerLine(playerText, null).Condition(new ConversationSentence.OnConditionDelegate(this.IsSuitableToTalk)).NpcLine(npcText, null, null).NpcLine(npcText2, null, null).BeginPlayerOptions().PlayerOption(text, null).NpcLine(npcText3, null, null).Consequence(new ConversationSentence.OnConsequenceDelegate(this.AcceptCounterOffer)).CloseDialog().PlayerOption(text2, null).NpcLine(npcText4, null, null).CloseDialog();
			}

			// Token: 0x06004909 RID: 18697 RVA: 0x001522ED File Offset: 0x001504ED
			private bool IsSuitableToTalk()
			{
				return Settlement.CurrentSettlement == base.QuestGiver.CurrentSettlement && CharacterObject.OneToOneConversationCharacter.IsHero && CharacterObject.OneToOneConversationCharacter.HeroObject == this.AntagonistHero;
			}

			// Token: 0x0600490A RID: 18698 RVA: 0x00152324 File Offset: 0x00150524
			private void AcceptCounterOffer()
			{
				Hero antagonistHero = this.AntagonistHero;
				TextObject textObject = new TextObject("{=q4wWEbsa}You decided not to deliver the items after listening to {COUNTER_OFFER_HERO.LINK}.", null);
				StringHelpers.SetCharacterProperties("COUNTER_OFFER_HERO", antagonistHero.CharacterObject, textObject, false);
				ChangeRelationAction.ApplyPlayerRelation(antagonistHero, 5, true, true);
				antagonistHero.AddPower(5f);
				TraitLevelingHelper.OnIssueSolvedThroughBetrayal(base.QuestGiver, new Tuple<TraitObject, int>[]
				{
					new Tuple<TraitObject, int>(DefaultTraits.Honor, -50)
				});
				base.QuestGiver.CurrentSettlement.Town.Prosperity -= 30f;
				base.CompleteQuestWithFail(textObject);
			}

			// Token: 0x0600490B RID: 18699 RVA: 0x001523B4 File Offset: 0x001505B4
			protected override void OnCompleteWithSuccess()
			{
				base.QuestGiver.AddPower(10f);
				TraitLevelingHelper.OnIssueSolvedThroughQuest(base.QuestGiver, new Tuple<TraitObject, int>[]
				{
					new Tuple<TraitObject, int>(DefaultTraits.Honor, 50)
				});
				base.QuestGiver.CurrentSettlement.Town.Prosperity += 30f;
				this.RelationshipChangeWithQuestGiver = 5;
				if (this.AntagonistHero != null)
				{
					this.AntagonistHero.AddPower(-10f);
					ChangeRelationAction.ApplyPlayerRelation(this.AntagonistHero, -10, true, true);
				}
				GiveGoldAction.ApplyForQuestBetweenCharacters(base.QuestGiver, Hero.MainHero, this._rewardGold, false);
				base.AddLog(this._successQuestLogText, false);
			}

			// Token: 0x0600490C RID: 18700 RVA: 0x00152465 File Offset: 0x00150665
			public override void OnFailed()
			{
				base.QuestGiver.AddPower(-10f);
				this.RelationshipChangeWithQuestGiver = -5;
				base.QuestGiver.CurrentSettlement.Town.Prosperity -= 20f;
			}

			// Token: 0x0600490D RID: 18701 RVA: 0x001524A0 File Offset: 0x001506A0
			protected override void OnTimedOut()
			{
				base.AddLog(this._timeoutQuestLogText, false);
				base.QuestGiver.AddPower(-20f);
				this.RelationshipChangeWithQuestGiver = -5;
				base.QuestGiver.CurrentSettlement.Town.Prosperity -= 50f;
			}

			// Token: 0x040018E6 RID: 6374
			[SaveableField(20)]
			private int _rewardGold;

			// Token: 0x040018E7 RID: 6375
			[SaveableField(30)]
			private readonly ItemObject _requestedTradeGood;

			// Token: 0x040018E8 RID: 6376
			[SaveableField(60)]
			private readonly int _requestedTradeGoodAmount;

			// Token: 0x040018E9 RID: 6377
			[SaveableField(40)]
			private int _givenTradeGoods;

			// Token: 0x040018EA RID: 6378
			[SaveableField(50)]
			private JournalLog _playerStartsQuestLog;
		}

		// Token: 0x02000606 RID: 1542
		public class ArtisanOverpricedGoodsIssueTypeDefiner : SaveableTypeDefiner
		{
			// Token: 0x06004914 RID: 18708 RVA: 0x00152620 File Offset: 0x00150820
			public ArtisanOverpricedGoodsIssueTypeDefiner() : base(470000)
			{
			}

			// Token: 0x06004915 RID: 18709 RVA: 0x0015262D File Offset: 0x0015082D
			protected override void DefineClassTypes()
			{
				base.AddClassDefinition(typeof(ArtisanOverpricedGoodsIssueBehavior.ArtisanOverpricedGoodsIssue), 1, null);
				base.AddClassDefinition(typeof(ArtisanOverpricedGoodsIssueBehavior.ArtisanOverpricedGoodsIssueQuest), 2, null);
			}
		}
	}
}
